﻿using System;
using BizUnit;
using BizUnit.BizUnitOM;
using System.IO;
using System.Diagnostics;
using BTS.Testing.TraceMonitor.BizUnitSteps.TraceControlAgent;

namespace BTS.Testing.TraceMonitor.BizUnitSteps
{
    /// <summary>
    /// For demo purposes this sample step will write something to the trace using the CAT logging framework which can be tested by other steps
    /// </summary>
    public class ExampleTraceStep : ITestStepOM 
    {
        public string TraceMessage { set; get;} 
        /// <summary>
        /// Executes the bizunit step
        /// </summary>
        /// <param name="testConfig"></param>
        /// <param name="context"></param>
        public void Execute(System.Xml.XmlNode testConfig, Context context)
        {
            TraceMessage = context.ReadConfigAsString(testConfig, "TraceMessage");
            Execute(context);
        }
        /// <summary>
        /// Execute
        /// </summary>
        /// <param name="context"></param>
        public void Execute(Context context)
        {
            Execute();
        }
        /// <summary>
        /// Execute
        /// </summary>
        public void Execute()
        {
            Microsoft.BizTalk.CAT.BestPractices.Framework.Instrumentation.TraceManager.CustomComponent.TraceInfo(TraceMessage);
        }
        /// <summary>
        /// Validate
        /// </summary>
        /// <param name="context"></param>
        public void Validate(Context context)
        {
            
        }
    }
}

